package com.qf.common.third;

import redis.clients.jedis.Jedis;

public class JedisUtil {

    private Jedis jedis;

    private static JedisUtil util = new JedisUtil();

    private JedisUtil() {
        jedis = new Jedis("47.93.124.193", 6379);
    }

    public static JedisUtil getInstance() {
        return util;
    }

    //新增
    public void addStr(String key, String val) {
        jedis.set(key, val);
    }

    public void addStrEx(String key, String val, int second) {
        jedis.setex(key, second, val);
    }
    //删除

    //修改

    //查询
    public String getStr(String key) {
        return jedis.get(key);
    }

    //系统
    public boolean ishave(String key) {
        return jedis.exists(key);
    }

    public void addHash(String key, String field, String value) {
        jedis.hset(key,field,value);
    }

    public boolean delKey(String... keys) {
        return jedis.del(keys) >0;
    }
}
